//
//  YSEmotionButton.swift
//  新浪浪
//
//  Created by mac on 16/3/11.
//  Copyright © 2016年 mac. All rights reserved.
//

import UIKit

class YSEmotionButton: UIButton {

    var emotion: YSEmotion?{
        didSet{
            if let png = emotion!.png{
                let imagPath = "\(emotion!.path!)/\(png)"
                self.setTitle(nil, forState: UIControlState.Normal)
                self.setImage(UIImage (named: imagPath), forState: UIControlState.Normal)
                self.hidden = false
            }
            if let emoji = emotion!.emoji{
                self.setImage(nil, forState: UIControlState.Normal)
                self.setTitle(emoji, forState: UIControlState.Normal)
                self.hidden = false
                self.titleLabel?.font = UIFont.systemFontOfSize(38)
            }
        }
    }

}
